<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>

  <body>
    <div id="app">
      <h1
        :ref="(el)=>{
      log(el);
     }"
      >
        hello
      </h1>
      <h2 :ref="getH2">jack</h2>
    </div>
    <script type="module">
      import { createApp, ref } from "./vue.esm-browser.js";
      const app = createApp({
        setup() {
          const arr = ref(["css", "html", "js"]);
          const items = ref([]);

          function getH2(el) {
            // console.log(el);
            el.style.color = "red";
          }
          return {
            log: (ctx) => console.log(ctx),
            getH2,
          };
        },
      });

      app.mount("#app"); //挂载
    </script>
  </body>
</html>
